using System.ComponentModel.DataAnnotations;

namespace GroupSix.Application.Dtos;

/// <summary>
/// 获取用户个人信息响应DTO
/// </summary>
public class UserProfileResponseDto
{
    public Guid Id { get; set; }
    public string Username { get; set; } = string.Empty;
    public string? Nickname { get; set; }
    public string Email { get; set; } = string.Empty;
    public string? Phone { get; set; }
    public string? Avatar { get; set; }
    public int Status { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime? UpdatedAt { get; set; }
    
    /// <summary>
    /// 用户角色列表
    /// </summary>
    public List<UserRoleDto> Roles { get; set; } = new();
    
    /// <summary>
    /// 用户权限列表
    /// </summary>
    public List<string> Permissions { get; set; } = new();
}

/// <summary>
/// 更新用户个人信息请求DTO
/// </summary>
public class UpdateUserProfileRequestDto
{
    [Required(ErrorMessage = "用户ID不能为空")]
    public Guid UserId { get; set; }

    [StringLength(50, ErrorMessage = "昵称长度不能超过50个字符")]
    public string? Nickname { get; set; }

    [Required(ErrorMessage = "邮箱不能为空")]
    [EmailAddress(ErrorMessage = "邮箱格式不正确")]
    [StringLength(100, ErrorMessage = "邮箱长度不能超过100个字符")]
    public string Email { get; set; } = string.Empty;

    [StringLength(20, ErrorMessage = "电话号码长度不能超过20个字符")]
    [RegularExpression(@"^[0-9+\-\s()]*$", ErrorMessage = "电话号码格式不正确")]
    public string? Phone { get; set; }

    [StringLength(500, ErrorMessage = "头像URL长度不能超过500个字符")]
    public string? Avatar { get; set; }
}

/// <summary>
/// 更新用户个人信息响应DTO
/// </summary>
public class UpdateUserProfileResponseDto
{
    public Guid UserId { get; set; }
    public string Username { get; set; } = string.Empty;
    public string? Nickname { get; set; }
    public string Email { get; set; } = string.Empty;
    public string? Phone { get; set; }
    public string? Avatar { get; set; }
    public DateTime UpdatedAt { get; set; }
    public string Message { get; set; } = string.Empty;
}